package nc.impl.hdysc.wbs;

import nc.bs.dao.BaseDAO;
import nc.bs.hdysc.dao.WebDataDao;
import nc.bs.logging.Logger;
import nc.itf.hdysc.wbs.IUserWbs;
import nc.vo.hdysc.user.UserVO;
import nc.vo.pub.VOStatus;

public class UserWbsImpl implements IUserWbs{

	public boolean saveUser(String userId, int insertOrUpdate) {
		WebDataDao dao = new WebDataDao() ;
		try{
			UserVO vo = dao.qryByPk(userId, UserVO.class) ;
			vo.setPk_company("0001") ;
			vo.setApprove_status(8) ;
			
			
			BaseDAO baseDao = new BaseDAO() ;
			if(insertOrUpdate == 0){
				baseDao.insertVOWithPK(vo) ;
				
			}else{
				vo.setStatus(VOStatus.UPDATED) ;
				baseDao.updateVO(vo) ;
			}
		}catch (Exception e) {
			Logger.error(e) ;
			e.printStackTrace() ;
			return false ;
		}
		return true;
	}

}
